/**

This file is part of MaCI/GIMnet.

MaCI/GIMnet is free software: you can redistribute it and/or modify it 
under the terms of the GNU Lesser General Public License as published 
by the Free Software Foundation, either version 3 of the License, or 
(at your option) any later version.

MaCI/GIMnet is distributed in the hope that it will be useful, but WITHOUT 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public 
License for more details.

You should have received a copy of the GNU Lesser General Public 
License along with GIMnet. (See COPYING.LESSER) If not, see 
<http://www.gnu.org/licenses/>.

**/
#ifndef MATERIALHANDLER_H
#define MATERIALHANDLER_H

/*
* Material handler keeps score which geom has what collision properties.
* Geoms and corresponding materials can be added, and contacts between 2 geoms
* can be requested. If geom has no material defined, default material is used.
* Returned contact's parameters depend on both geoms materials (TODO: exlpanation in manual).
*
* At the moment contacts are simply averages from different material properties 
* and special effects like contact directions are not used. Still, the Material 
* class is hopefully enough to make it possible to implement later.
*/

#include <cstdlib>
#include <map>

#include "ode/ode.h"

struct TMaterial;

typedef std::map<dGeomID,const TMaterial*>::iterator materialsIter;

class CMaterialHandler
{
  public:
    CMaterialHandler();
    ~CMaterialHandler();
  
    //takes 2 geoms and calculates a contact between them
    dSurfaceParameters GetContact(dGeomID ID1, dGeomID ID2);
    bool Add(dGeomID ID, const TMaterial *material);
    void Remove(dGeomID ID);
  
  private:
    std::map<dGeomID,const TMaterial*> materialsMap;
  protected:
    
};

#endif //MATERIALHANDLER_H
